<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<title>我的电商系统</title>
	<link rel="stylesheet" type="text/css" href="/tpshop/Public/css/bootstrap.min.css">
	<link rel="stylesheet" type="text/css" href="/tpshop/Public/css/bootstrap-theme.min.css">
	<link rel="stylesheet" type="text/css" href="/tpshop/Public/css/fornt.css">
</head>
<body id="lists">
<p><a href=""></a></p>
<div class="container">
	<div class="row">
		<div class="col-md-3 nav-left">
			<a href="/tpshop/index.php"><img id="logo"  src="/tpshop/Public/img/logo.jpg" /></a>
		</div>
		<div class="col-md-6">
			<p class="contect"><i class="glyphicon glyphicon-earphone"></i>400-12345678910<i class="glyphicon glyphicon-envelope"></i> shop@goodjobs.cn</p>
			<div class="input-group">
			    <input type="text" class="form-control" placeholder="请输入商品名称或编号">
			    <span class="input-group-btn">
			    	<button class="btn btn-default" type="button">搜索</button>
			    </span>
			</div>
		</div>
		<div class="col-md-3">
			<p class="header_right">
			<?php if($_SESSION['user_is_login']){?>
			<a href="<?php echo U('home/User/login')?>">欢迎回来,<?php echo $_SESSION['username']?></a>
			<a  class="pull-right exit" href="<?php echo U('home/User/destroy') ?>">安全退出</a>
			<?php }else{?>
				<a href="<?php echo U('home/User/login')?>">请登录</a>
				<a href="<?php echo U('home/User/regedit')?>">快速注册</a>
			<?php }?>
			</p>
			<a href="<?php echo U('home/Shopping/shopcart');?>" class="shopcart pull-right">
				<i class="glyphicon glyphicon-shopping-cart"></i>我的购物车
			<?php if($_SESSION['user_is_login']){ ?>
				<span><?php echo M('user_cart')->where('user_id='.$_SESSION['user_id'])->count();?></span>
				<?php }?>
			</a>
		</div>
	</div>
</div>

<br />
<div class="container">
	<div class="row">
		<div class="col-md-3 main_lists">
			<ul class="list-group">
				<li  id="lists_catalog"><a href="" style="text-decoration:none"><i class="glyphicon glyphicon-th-list"></i><?php echo $parent_catalog['name']?></a></li>
				<?php foreach($child_catalogs as $c){?>
				<li  id="lists_child"><a <?php if($c['id']==$catalog['id']){?> class="active" <?php }?> href="<?php echo U('home/Product/lists').'/catalog_id/'.$c['id']?>"><?php echo $c['name'];?></a></li>
				<?php }?>
			</ul>
		</div>
		<div class="col-md-9 lists_right">
			<table cellpadding="0" cellspacing="0" class="lists_table">
				<tr>
					<td class="pic">品牌</td>
					<td class="pic_detail">佳能 尼康 索尼</td>
				</tr>
				<tr>
					<td class="pic">单反级别</td>
					<td class="pic_detail">入门级 中级 高级</td>
				</tr>
				<tr>
					<td class="pic">屏幕尺寸</td>
					<td class="pic_detail">3英寸 3.2英寸</td>
				</tr>
				<tr>
					<td class="pic">价格</td>
					<td class="pic_detail">1360以下元 1360-2720元 2720-4080元 6800以上元</td>
				</tr>
			</table>
			<br />
			<div class="option"><a hred="#" class="option_bg">默认</a><a hred="#" class="">销量</a><a hred="#" class="">价格</a><a hred="#" class="">评论</a><a hred="#" class="">新品</a></div>
			<div class="row">
				<div class="col-md-12">
					<?php foreach($brands as $b){?>
						<a href="<?php echo U('home/Product/lists/catalog_id/'.$catalog['id']).'?brand='.$b['id'];?>"><?php echo $b['name'];?></a>
					<?php }?>
				</div>
			</div>
			<div class="row">
			<?php foreach($products_imgs as $p){?>
				<div class="col-md-3 products_lists clearfix">
					<img class="main_img" src="/tpshop/<?php echo $p['img']?>"  />
					<?php $imgs=M('product_img')->where('product_id='.$p['id'])->limit(4)->select(); ?>
					<ul class="products_lists_detail clearfix">
					<?php foreach($imgs as $img){?>
						<li class=""><img src="/tpshop<?php echo $img['url']?>" /></li>
					<?php }?>
					</ul>
					<p class="price"> ￥<?php echo $p['price']; ?></p>
					<p class="title"><a href="<?php echo U('home/Product/detail/id/'.$p['id']);?>"><?php echo $p['title']; ?></a></p>
					<a class="btn btn-danger add_shopcart">加入购物车</a>
				</div>
			<?php }?>
			</div>
		</div>
	</div>	
</div>
</body>
	<script type="text/javascript" src="/tpshop/Public/js/jquery.js"></script>
	<script type="text/javascript" src="/tpshop/Public/js/bootstrap.min.js"></script>
	<script type="text/javascript">
		$(function(){
			$('.option a').click(function(){
				$('.option a').removeClass('option_bg');
				$(this).addClass('option_bg');
			})
			$('.products_lists_detail li').mouseover(function(){
	    		$(this).parents('.products_lists').find('ul li').removeClass('hover');
	    		$(this).addClass('hover');
	    		var src=$(this).find('img').attr('src');
	    		$(this).parents('.products_lists').find('.main_img').attr('src',src);
	    	});
		})
	</script>
</html>